//
//  HotMeiShiCollectionViewCell.m
//  DongChiDaChiProject1
//
//  Created by lanou3g on 15/10/28.
//  Copyright © 2015年 com.lanou3g. All rights reserved.
//

#import "HotMeiShiCollectionViewCell.h"

@implementation HotMeiShiCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // 添加视图
        [self addView];
    }
    return self;
}

// 添加视图
- (void)addView
{
    // 图片
    self.pictureImage = [[UIImageView alloc] initWithFrame:CGRectMake(15 * kWidthFitParameter, 10 * kWidthFitParameter, self.width - 30 * kWidthFitParameter, self.height - 20 * kWidthFitParameter)];
    self.pictureImage.layer.cornerRadius = 15 * kWidthFitParameter;
    self.pictureImage.layer.masksToBounds = YES;
   // self.pictureImage.backgroundColor = [UIColor magentaColor];
    [self.contentView addSubview:_pictureImage];
    
    // 菜名
    self.caiMingLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width / 20, 130 * kWidthFitParameter, 150 * kWidthFitParameter, 30 * kWidthFitParameter)];
    //self.caiMingLabel.backgroundColor = [UIColor cyanColor];
    self.caiMingLabel.textColor = [UIColor whiteColor];
    [self.pictureImage addSubview:_caiMingLabel];
    
    // 功效
    self.effectLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.width / 20, self.caiMingLabel.bottom + 15 * kWidthFitParameter, 150 * kWidthFitParameter, 30 * kWidthFitParameter)];
   // self.effectLabel.backgroundColor = [UIColor cyanColor];
    self.effectLabel.textColor = [UIColor whiteColor];
    self.effectLabel.font = [UIFont systemFontOfSize:15 * kWidthFitParameter];
    [self.pictureImage addSubview:_effectLabel];
   
    
    // 适应人种
    self.ageLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.pictureImage.width - 100 * kWidthFitParameter, self.caiMingLabel.top , 80 * kWidthFitParameter, 50 * kWidthFitParameter)];
   // self.ageLabel.backgroundColor = [UIColor cyanColor];
    self.ageLabel.textColor = [UIColor whiteColor];
    self.ageLabel.numberOfLines = 0;
    self.ageLabel.font = [UIFont systemFontOfSize:13 * kWidthFitParameter];
    [self.pictureImage addSubview:_ageLabel];
    
    
}

- (void)setModel:(HotMeiShiModel *)model
{
    [self.pictureImage sd_setImageWithURL:[NSURL URLWithString:model.thumb_2] placeholderImage:[UIImage imageNamed:@"placehoder.jpg"]];
    self.caiMingLabel.text = model.title;
    self.effectLabel.text = model.effect;
    self.ageLabel.text = model.age;
    
    
    
}


@end
